package www.dianbaozu.com.ui

import android.view.View
import androidx.core.view.isVisible
import www.wen.com.common.R
import www.wen.com.common.databinding.ArActivityGuidanceBinding
import www.wen.com.common.lib.base.activity.BaseActivity
import www.wen.com.common.lib.extension.configuration
import www.wen.com.common.lib.helper.adapter.banner.DefaultImageAdapter

/**
 * 开启的引导页,以后可能用到
 */
class GuidanceActivity : BaseActivity<ArActivityGuidanceBinding>(), View.OnClickListener {

    private val mGuidanceImages = arrayListOf(R.drawable.ar_guidance1, R.drawable.ar_guidance2, R.drawable.ar_guidance3)

    override fun getLayout(): Int = R.layout.ar_activity_guidance

    override fun initialize() {
        dataBinding.listener = this
        dataBinding.bannerGuidance.configuration(
                owner = this,
                provideAdapter = ::provideAdapter,
                onPageSelectedBA = ::onPageSelected
        )
    }

    private fun onPageSelected(position: Int) {
        dataBinding.btnIntoApp.isVisible = position == mGuidanceImages.size - 1
    }

    private fun provideAdapter() = DefaultImageAdapter(arrayListOf(
            R.drawable.ar_guidance1,
            R.drawable.ar_guidance2,
            R.drawable.ar_guidance3,
    ))

    override fun onClick(v: View) {
    }

}

